package com.woniu.cq.medical.dao;

import com.woniu.cq.medical.controller.form.PatientWaitForm;
import com.woniu.cq.medical.controller.form.RegisterListForm;
import com.woniu.cq.medical.entity.Patient;
import com.woniu.cq.medical.entity.Register;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Lucas
 * @since 2020-09-05
 */
public interface RegisterMapper extends BaseMapper<Register> {
    public List<String> queryWaitPatientList(@Param("date") Date date, @Param("doctorId")int doctorId, @Param("status")String status,@Param("isValid") String isValid);
    List<Register> queryRegisterThree(String patientIdCard,Date startTime,Date endTime,String status);
    public List<Patient> getWaitPatientList(@Param("date") Date date, @Param("doctorId")int doctorId, @Param("status")String status,@Param("isValid") String isValid);
    public PatientWaitForm getCurrPatient(@Param("date") Date date, @Param("doctorId")int doctorId, @Param("status")String status);

    /**
     * 根据身份证ID 和 当前时间查询（如果当天超过5点则延后一天查询）今天是否有挂号记录
     * @param patientIdCard
     * @param currentTime
     * @return
     */
    List<Register> queryRegisterRepetition(String patientIdCard,LocalDate currentTime);

    void changeRegisterStatusByRegisterId(@Param("registerId") int registerId, @Param("status")String status);

    int selectPatientCountByStatus(@Param("doctorId") int doctorId, @Param("date") Date date, @Param("status") String status);

    String selectIsValidByRegisterId(int registerId);

    void updateIsValid(@Param("registerId") int registerId, @Param("isValid") String isValid);

    List<RegisterListForm> queryRegisterList(String patientIdCard);

    int selectCheckedCount(@Param("doctorId") int doctorId, @Param("date") Date date, @Param("status") String status);

    String selectCurrPatient(@Param("doctorId") int doctorId, @Param("date") Date date,@Param("status")String status);

    int selectWaitPatient(@Param("doctorId") int doctorId, @Param("date") Date date,@Param("status") String status,@Param("isValid") String isValid);

    /**
     * 检查当天是否重复挂号
     * @param patientIdCard
     * @param dutyId
     * @return
     */
    List<Register> queryRegisterTwo(String patientIdCard, Integer dutyId);
}

